package com.qujia.customer.mapper;

import com.qujia.customer.domain.CustomerCardUseRecord;
import com.qujia.customer.domain.CustomerElectronicCard;
import com.qujia.customer.domain.ElecSumInfo;
import com.qujia.customer.domain.from.UserBalanceForm;
import com.qujia.customer.domain.vo.UserBalanceSumVO;
import com.qujia.customer.domain.vo.UserBalanceVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 客户电子会员卡（储蓄卡）Mapper接口
 * 
 * @author qujia
 * @date 2021-04-12
 */
public interface CustomerElectronicCardMapper 
{
    /**
     * 查询客户电子会员卡（储蓄卡）
     * 
     * @param id 客户电子会员卡（储蓄卡）ID
     * @return 客户电子会员卡（储蓄卡）
     */
    public CustomerElectronicCard selectCustomerElectronicCardById(Long id);

    public CustomerElectronicCard selectCustomerElectronicCard(Long id);

    /**
     * 查询客户电子会员卡（储蓄卡）列表
     * 
     * @param customerElectronicCard 客户电子会员卡（储蓄卡）
     * @return 客户电子会员卡（储蓄卡）集合
     */
    public List<CustomerElectronicCard> selectCustomerElectronicCardList(CustomerElectronicCard customerElectronicCard);

    /**
     * 新增客户电子会员卡（储蓄卡）
     * 
     * @param customerElectronicCard 客户电子会员卡（储蓄卡）
     * @return 结果
     */
    public int insertCustomerElectronicCard(CustomerElectronicCard customerElectronicCard);

    /**
     * 修改客户电子会员卡（储蓄卡）
     * 
     * @param customerElectronicCard 客户电子会员卡（储蓄卡）
     * @return 结果
     */
    public int updateCustomerElectronicCard(CustomerElectronicCard customerElectronicCard);

    /**
     * 删除客户电子会员卡（储蓄卡）
     * 
     * @param id 客户电子会员卡（储蓄卡）ID
     * @return 结果
     */
    public int deleteCustomerElectronicCardById(Long id);

    /**
     * 批量删除客户电子会员卡（储蓄卡）
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteCustomerElectronicCardByIds(Long[] ids);

    /**
     * 查询电子会员数据
     */
    public CustomerElectronicCard listSum(CustomerElectronicCard customerElectronicCard);

    /**
     * 查询电子会员报表数据
     */
    public List<CustomerElectronicCard> selectCard(CustomerElectronicCard customerElectronicCard);

    public List<CustomerElectronicCard> selectCardPage(CustomerElectronicCard customerElectronicCard);

    public CustomerElectronicCard listHYData(CustomerElectronicCard customerElectronicCard);

    public CustomerElectronicCard listJRHYData(CustomerElectronicCard customerElectronicCard);


    /**
     * 查询电子卡的汇总信息
     */
    public List<CustomerElectronicCard> cardUserSum(CustomerElectronicCard customerElectronicCard);


    List<ElecSumInfo> getRechargeSum(CustomerCardUseRecord customerCardUseRecord);

    List<ElecSumInfo> getManualDeduction(CustomerCardUseRecord customerCardUseRecord);

    List<ElecSumInfo> getConsumeSum(CustomerCardUseRecord customerCardUseRecord);


    List<ElecSumInfo> getBalanceSum(@Param("card") CustomerElectronicCard customerElectronicCard, @Param("cardUseForAll") boolean cardUseForAll);

    List<CustomerElectronicCard> getElectronicCardListBycardOilsTypeArray(CustomerElectronicCard customerElectronicCard);

    int incrCustomerElectronicCardBalance(@Param("incrAmt") BigDecimal incrAmt,@Param("incrPresentAmt") BigDecimal incrPresentAmt, @Param("card") CustomerElectronicCard card);

    int insertBatch(@Param("list") List<CustomerElectronicCard> cardList);

    BigDecimal countCardBalance(@Param("mobilePhone") String mobilePhone,
                                //@Param("memberCode") String memberCode,
                                @Param("enterpriseId") Integer enterpriseId,
                                @Param("cardUseForAll") boolean cardUseForAll,
                                @Param("cardTypes") List<String> types);

    
    CustomerElectronicCard getElectronicCardInfo(CustomerElectronicCard customerElectronicCard);

    List<CustomerElectronicCard> queryListOrderByCardType(CustomerElectronicCard customerElectronicCard);

    int countUserBalanceVO(UserBalanceForm form);

    List<UserBalanceVO> queryUserBalanceVO(UserBalanceForm form);

    UserBalanceSumVO sumUserBalanceVO(UserBalanceForm form);

    UserBalanceSumVO sumUserBalanceVOReturnCash(UserBalanceForm form);
}
